<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Logout extends CI_Controller {
	
	public function __construct()
	{
		parent::__construct();
		$this->load->library('session');
		$this->load->library('tank_auth');
		$this->load->helper('url');
		$this->load->helper('form');
		
		// prevent caching
		$this->output->set_header('Last-Modified:'.gmdate('D, d M Y H:i:s').'GMT');
		$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate');
		$this->output->set_header('Cache-Control: post-check=0, pre-check=0',false);
		$this->output->set_header('Pragma: no-cache');
		
		// if no session, redirect to login page
		if(!$this->tank_auth->is_logged_in())
		{
			redirect('admin/login', 'refresh');
		}
	}
	
	public function index()
	{	
		$this->tank_auth->logout();
		redirect('admin/login', 'refresh');
	}
}

/* End of file logout.php */
/* Location: ./application/controllers/admin/logout.php */